unit PasswordFormUnit;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, Mask, SettingsUnit;

type
  TPasswordForm = class(TForm)
    BTN7: TButton;
    MaskEdit: TMaskEdit;
    BTN8: TButton;
    BTN9: TButton;
    BTN4: TButton;
    BTN5: TButton;
    BTN6: TButton;
    BTN1: TButton;
    BTN2: TButton;
    BTN3: TButton;
    BTN0: TButton;
    BTNesc: TButton;
    BTNOK: TButton;
    procedure BTNOKClick(Sender: TObject);
    procedure FormKeyPress(Sender: TObject; var Key: Char);
    procedure FormShow(Sender: TObject);
    procedure BTN7Click(Sender: TObject);
    procedure BTN0Click(Sender: TObject);
    procedure BTN1Click(Sender: TObject);
    procedure BTN2Click(Sender: TObject);
    procedure BTN3Click(Sender: TObject);
    procedure BTN4Click(Sender: TObject);
    procedure BTN5Click(Sender: TObject);
    procedure BTN6Click(Sender: TObject);
    procedure BTN8Click(Sender: TObject);
    procedure BTN9Click(Sender: TObject);
  private
    { Private declarations }
  public
    SavePass:boolean;
    { Public declarations }
  end;

var
  PasswordForm: TPasswordForm;


implementation

uses Math, ShellFormUnit;

{$R *.dfm}

procedure TPasswordForm.BTNOKClick(Sender: TObject);
var
  pass:string;
begin
if SavePass then SettingsSaveValue('Common','Password',MaskEdit.Text);
SavePass := false;

pass := ShellForm.password;
  If MaskEdit.Text = pass then ModalResult := mrYes else ModalResult := mrNo;
end;

procedure TPasswordForm.FormKeyPress(Sender: TObject; var Key: Char);
begin
If Key = #27 then BTNesc.Click;
If Key = #13 then BTNOk.Click;
end;

procedure TPasswordForm.FormShow(Sender: TObject);
begin
MaskEdit.Clear;
end;

procedure TPasswordForm.BTN7Click(Sender: TObject);
begin
MaskEdit.Text := MaskEdit.Text + '7';
end;

procedure TPasswordForm.BTN0Click(Sender: TObject);
begin
MaskEdit.Text := MaskEdit.Text + '0';
end;

procedure TPasswordForm.BTN1Click(Sender: TObject);
begin
MaskEdit.Text := MaskEdit.Text + '1';
end;

procedure TPasswordForm.BTN2Click(Sender: TObject);
begin
MaskEdit.Text := MaskEdit.Text + '2';
end;

procedure TPasswordForm.BTN3Click(Sender: TObject);
begin
MaskEdit.Text := MaskEdit.Text + '3';
end;

procedure TPasswordForm.BTN4Click(Sender: TObject);
begin
MaskEdit.Text := MaskEdit.Text + '4';
end;

procedure TPasswordForm.BTN5Click(Sender: TObject);
begin
MaskEdit.Text := MaskEdit.Text + '5';
end;

procedure TPasswordForm.BTN6Click(Sender: TObject);
begin
MaskEdit.Text := MaskEdit.Text + '6';
end;

procedure TPasswordForm.BTN8Click(Sender: TObject);
begin
MaskEdit.Text := MaskEdit.Text + '8';
end;

procedure TPasswordForm.BTN9Click(Sender: TObject);
begin
MaskEdit.Text := MaskEdit.Text + '9';
end;

end.
